function htmlCompile(domVal, tableModel,indexData,boo) {
  let uniXml = {
    doc: {
      width: tableModel.pxWidth,
      height: tableModel.pxHeight,
      top: 10,
      left: 3,
      count: 1,
    },
    els: [],
  };
  console.log('domVal', domVal)
  console.log('tableModel', tableModel)
  console.log('indexData', indexData)
  console.log('boo',boo)

  for (let i = 0; i < domVal.length; i++) {
    let dom = domVal[i];
    switch (domVal[i].tagName) {
      case "P":
        break;
      case "TABLE":
        let lineHeight=parseInt((dom.style.lineHeight === "" ? 10 : parseInt(dom.style.lineHeight))*indexData.MmsPx)
        let tableHtml = {
          e: "table",
          marge:{},
          lineHeight:lineHeight,
          borderSize: dom.getAttribute("border"),
          font: {
            size: dom.style.fontSize === "" ? 13 : parseInt(dom.style.fontSize),
          },
          colwds: [],
          oc: [],

        };

        let tr = domVal[i].children[0].children;

        // tableStyle
        let tableMarginLeft = parseInt(parseInt(dom.style.marginLeft)*indexData.MmsPx);
        let tableMarginTop = parseInt(parseInt(dom.style.marginTop)*indexData.MmsPx);
        let domTableWidth = dom.style.width;
        if (domTableWidth == "100%"||domTableWidth == "") {
          domTableWidth = tableModel.pxWidth - 40;
        }
        if (isNaN(tableMarginLeft)) {
          tableMarginLeft = 0;
        }
        if (isNaN(tableMarginTop)) {
          tableMarginTop = 0;
        }
        let TableMarginRight = tableModel.pxWidth - tableMarginLeft - domTableWidth - 40;

        tableHtml.marge.left=tableMarginLeft
        tableHtml.marge.top=tableMarginTop
        tableHtml.marge.right=tableMarginLeft

        if (dom.getAttribute("colwds") !== null) {
          tableHtml.colwds = (dom.getAttribute("colwds")).split(",");
        } else {
          let array = new Array();
          let colwds = [];
          let num = 0;
          for (let i = 0; i < tr.length; i++) {
            array.push(tr[i]);
          }
          let dataArray = array.sort(function (obj1, obj2) {
            var val1 = obj1.childElementCount;
            var val2 = obj2.childElementCount;
            if (val1 < val2) {
              return 1;
            } else if (val1 > val2) {
              return -1;
            } else {
              return 0;
            }
          });
          let length = dataArray[0].children.length;
          let nowint = parseInt((1 / length) * 100);
          for (let i = 0; i < length; i++) {
            if (i == length - 1) {
              // console.log(colwds);
              colwds.push(100 - num);
            } else {
              colwds.push(nowint);
              num += nowint;
            }
          }
          tableHtml.colwds = colwds;
        }

        //rowStyle
        for (let y = 0; y < tr.length; y++) {
          let row = tr[y];
          let rowHtml = {
            e: "tb-row",
            oc: [],
          };
          let tipText = "info";
          let cellBox = row.children;

          if (row.getAttribute("foreach")) {
            tableHtml.source = "info.details";
            rowHtml.foreach = "d";
            tipText = "d";

            
            for (let j = 0; j < cellBox.length; j++) {
              let cell = cellBox[j];

              if(cell.children.length){
                let cellChildren = cell.children
                for (let i = 0; i < cellChildren.length; i++) {
                  if (cellChildren[i].tagName === 'IMG') {
                    let cellHtml = {
                      v: cellChildren[i].alt,
                      align: 0,
                      valign: 1,
                      tag:{"name":"image","style":{"width":cellChildren[i].width,"height":cellChildren[i].height}},
                      p:`${tipText}.${cellChildren[i].alt}`,
                    };
                    rowHtml.oc.push(cellHtml);
                  }
                }
              } else {
              let cellHtml = {
                v: "",
                align: 0,
                valign: 1,
                p:'',
              };
              //cellStyle
              if (cell.getAttribute("rowspan")) {
                cellHtml.rowspan = cell.getAttribute("rowspan");
              }
              if (cell.getAttribute("colspan")) {
                cellHtml.colspan = cell.getAttribute("colspan");
              }
              if (cell.style.textAlign === "center") {
                cellHtml.align = 1;
              }
              if (cell.style.textAlign === "left") {
                cellHtml.align = 0;
              }
              if(cell.getAttribute("underline")=='open'){
                cellHtml.borderLine=1;
              }
              if (cell.innerText === "") {
                cellHtml.v = "";
              } else {
                cellHtml.v = cell.innerText;
              }
              let cellName = cell.getAttribute("name");
              let type=cell.getAttribute("type");
              let typetemplate=''
              if(type=='date1'){
                typetemplate=`'yyyy-MM-dd HH:mm:ss'`
              }
              if(type=='date2'){
                typetemplate=`'yyyy-MM-dd HH:mm'`
              }
              if(type=='date3'){
                typetemplate=`'yyyy-MM-dd HH'`
              }
              if(type=='date4'){
                typetemplate=`'yyyy-MM-dd'`
              }
              if(type=='date5'){
                typetemplate=`'yy-MM-dd'`
              }
              let firstText=''
              let lastText=''
              let timeSelect=''
              let innertext=cell.innerText
              if(!innertext.trim()&&cellName!==''){
                //空
  
              }else{
                if(boo){
                  timeSelect=''
                }else{
                  let firstIndex=innertext.indexOf('【')
                  let lastIndex=innertext.indexOf('】')
                  firstText=innertext.substr(0,firstIndex)
                  lastText=innertext.substr(lastIndex+1)
                  if(typetemplate!==''){
                    timeSelect=`function(info){ if(!info){ return '' }else{ return($dlh.tools.convert.dateFormat( '${firstText}'+ ${tipText}.${cellName}+'${lastText}', ${typetemplate}) || '');}}`
                  }else{
                    timeSelect=`${tipText}.${cellName}`
                  }
                }
                if(cellName){
                  cellHtml.p = timeSelect;
                }
              }
              // console.log('cellHtml', cellHtml)
              rowHtml.oc.push(cellHtml);
            }
          }
          } else {
            for (let j = 0; j < cellBox.length; j++) {
              let cell = cellBox[j];
              console.log('cellBox', cellBox )
              console.log('cell', cell )
              // 单元格内有图片元素
              if(cell.children.length){
                let cellChildren = cell.children
                for (let i = 0; i < cellChildren.length; i++) {
                  if (cellChildren[i].tagName === 'IMG') {
                    let cellHtml = {
                      v: cellChildren[i].alt,
                      align: 0,
                      valign: 1,
                      tag:{"name":"image","style":{"width":cellChildren[i].width,"height":cellChildren[i].height}},
                      eval:`function(info){ return '${tipText}.${cellChildren[i].alt}';}`,
                    };
                    rowHtml.oc.push(cellHtml);
                  }
                }
              } else {
                let cellHtml = {
                  v: "",
                  align: 0,
                  valign: 1,
                  eval:'',
                };
                //cellStyle
                if (cell.getAttribute("rowspan")) {
                  cellHtml.rowspan = cell.getAttribute("rowspan");
                }
                if (cell.getAttribute("colspan")) {
                  cellHtml.colspan = cell.getAttribute("colspan");
                }
                if (cell.style.textAlign === "center") {
                  cellHtml.align = 1;
                }
                if (cell.style.textAlign === "left") {
                  cellHtml.align = 0;
                }
                if(cell.getAttribute("underline")=='open'){
                  cellHtml.borderLine=1;
                }
                if (cell.innerText === "") {
                  cellHtml.v = "";
                } else {
                  cellHtml.v = cell.innerText;
                }
                let cellName = cell.getAttribute("name");
                let type=cell.getAttribute("type");
                let typetemplate=''
                console.log('type', type)
                if(type=='date1'){
                  typetemplate=`'yyyy-MM-dd HH:mm:ss'`
                }
                if(type=='date2'){
                  typetemplate=`'yyyy-MM-dd HH:mm'`
                }
                if(type=='date3'){
                  typetemplate=`'yyyy-MM-dd HH'`
                }
                if(type=='date4'){
                  typetemplate=`'yyyy-MM-dd'`
                }
                if(type=='date5'){
                  typetemplate=`'yy-MM-dd'`
                }
                let firstText=''
                let lastText=''
                let timeSelect=''
                let innertext=cell.innerText
                if(!innertext.trim()&&cellName!==''){
                  //空
    
                }else{
                  if(boo){
                    timeSelect=''
                  }else{
                    let firstIndex=innertext.indexOf('【')
                    let lastIndex=innertext.indexOf('】')
                    firstText=innertext.substr(0,firstIndex)
                    lastText=innertext.substr(lastIndex+1)
                    if(typetemplate!==''){
                      timeSelect=`function(info){ if(!info){ return '' }else{ return($dlh.tools.convert.dateFormat( '${firstText}'+ ${tipText}.${cellName}+'${lastText}', ${typetemplate}) || '');}}`
                    }else{
                      timeSelect=`function(info){ return '${firstText}'+ ${tipText}.${cellName}+'${lastText}'}`
                    }
                  }
                  if(cellName){
                    cellHtml.eval = timeSelect;
                  }
                }
                rowHtml.oc.push(cellHtml);
              }
              // console.log('cellHtml', cellHtml)

          }
          }
          // console.log('rowHtml', rowHtml)
          tableHtml.oc.push(rowHtml);
        }
        uniXml.els.push(tableHtml);
        break;
    }
  }
  return uniXml
  // return JSON.parse(JSON.stringify(uniXml));
}

